package com.bd08.flink.demo.jing

import org.apache.flink.api.scala.ExecutionEnvironment
import org.apache.flink.streaming.api.scala.createTypeInformation

object LocalFileDemo extends App {

  val benv = ExecutionEnvironment.getExecutionEnvironment
  //读取本地文本文件，指定目录或文件名称
  val localLines = benv.readTextFile("D:\\yahu\\bugeikan\\src\\main\\resources\\lines.txt")

  localLines.flatMap { _.toLowerCase.split("\\W+") filter { _.nonEmpty } }
    .map { (_, 1) }
    .groupBy(0)
    .sum(1)
    .print()



}
